package com.kotasoft.training.roogwteclipselink.shared.domain;

import javax.persistence.Column;
import javax.persistence.ManyToOne;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooEntity
public class Alumno {

    @NotNull
    private String nombre;

    @NotNull
    private String apellidos;

    @NotNull
    @Pattern(regexp = "^[^@ ]+@[^@ ]+.[^@ .]+$")
    private String email;

    @Pattern(regexp = "^(ht|f)tp(s?)\\\\:\\\\/\\\\/[0-9a-zA-Z]([-.\\\\w]*[0-9a-zA-Z])*(:(0-9)*)*(\\\\/?)( [a-zA-Z0-9\\\\-\\\\.\\\\?\\\\,\\\\'\\\\/\\\\\\\\\\\\+&%\\\\$#_]*)?$")
    private String web;

    @NotNull
    @Min(600000000L)
    @Max(699999999L)
    private Integer telefono;

    @NotNull
    @Column(unique = true)
    @Size(min = 9, max = 9)
    private String dni;

    @NotNull
    @ManyToOne
    private Direccion direccion;
}
